package com.fs.sale.controller;

import com.fs.common.core.vo.AjaxResult;
import com.fs.sale.pojo.OutboundDelivery;
import com.fs.sale.service.ObdDeliveryService;
import com.fs.sale.vo.ObdDeliveryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("obd")
public class ObdDeliveryController {
    @Autowired
    ObdDeliveryService obdDeliveryService;

    @PostMapping("select")
    public AjaxResult select(){
        AjaxResult ajaxResult=new AjaxResult();
        List<ObdDeliveryVo> obdDeliveryVoList=obdDeliveryService.select();
        ajaxResult.put("obdDeliveryVoList",obdDeliveryVoList);
        return ajaxResult;
    }
    @PostMapping("insert")
    public AjaxResult insert(@RequestBody OutboundDelivery outboundDelivery){
        if(obdDeliveryService.insert(outboundDelivery)>0){
          return AjaxResult.success();
        }
        return AjaxResult.error();
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody OutboundDelivery outboundDelivery){
           if(obdDeliveryService.update(outboundDelivery)>0){
               return AjaxResult.success();
           }
           return AjaxResult.error();
    }
}
